﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace cpe.cpein.SERVER
{
    [ServiceContract]
    public interface IUsersService
    {
        [OperationContract]
        List<RelationType> GetAllRelationType(bool serachInDeleted, User current);

        [OperationContract]
        RelationType GetRelationType(User user, User current);

        [OperationContract]
        bool ChangeRelationType(User user1, User user2, int type, User current);

        [OperationContract]
        List<User> GetAllUsers(bool serachInDeleted, User current);

        [OperationContract]
        List<User> GetRelations(User user, User current);

        [OperationContract]
        List<User> GetPotentialRelations(User user, User current);

        [OperationContract]
        User GetUserByID(int id, User current);

        [OperationContract]
        Group GetGroupByID(int id, User current);

        [OperationContract]
        User AddUser(User user, User current);

        [OperationContract]
        bool RemoveUser(User user, User current);

        [OperationContract]
        User UpdateUser(User user, User current);

        [OperationContract]
        Group UpdateGroup(Group group, User current);

        [OperationContract]
        bool DisconnectUser(User user, User current);

        [OperationContract]
        List<Message> GetNewsFeed(User user, User current);

        [OperationContract]
        Message AddNews(Message msg, User current);

        [OperationContract]
        List<Group> GetGroups(User user, User current);

        [OperationContract]
        List<Group> GetAllGroups(bool searchInDeleted, User current);

        [OperationContract]
        List<GroupType> GetAllGroupTypes(User current);

        [OperationContract]
        List<Country> GetAllCountries(User current);

        [OperationContract]
        List<User> GetGroupMembers(Group group, User current);

        [OperationContract]
        User ConnectUser(string login, string password);

        [OperationContract]
        User RegisterUser(string login, string password);

        [OperationContract]
        User CloneUser(User u);

        [OperationContract]
        List<Skill> GetSkills(User user, User current);

        [OperationContract]
        Group AddGroup(Group group, User current);

        [OperationContract]
        bool ConnectUserToGroup(Group group, User user, User current);

        [OperationContract]
        bool DisconnectUserToGroup(Group group, User user, User current);
    }


    // The User object as WS's client view it.
    [DataContract]
    [Serializable]
    public class User
    {
        [DataMember]
        public int Id { get; set; }
        [DataMember]
        public string Name { get; set; }
        [DataMember]
        public string Lastname { get; set; }
        [DataMember]
        public string Email { get; set; }
        [DataMember]
        public int IDAddress { get; set; }
        [DataMember]
        public Address Address { get; set; }
        [DataMember]
        public bool IsDeleted { get; set; }
        [DataMember]
        public string Login { get; set; }
        [DataMember]
        public string Password { get; set; }
    }


    [DataContract]
    [Serializable]
    public class Skill
    {
        [DataMember]
        public int Id { get; set; }
        [DataMember]
        public string Label { get; set; }
        [DataMember]
        public bool IsDeleted { get; set; }
    }


    // The Address object as WS's client view it.
    [DataContract]
    [Serializable]
    public class Address
    {
        [DataMember]
        public int Id { get; set; }
        [DataMember]
        public string Label { get; set; }
        [DataMember]
        public string Addr { get; set; }
        [DataMember]
        public int IDCountry { get; set; }
        [DataMember]
        public Country Country { get; set; }
        [DataMember]
        public string Zipcode { get; set; }
        [DataMember]
        public string City { get; set; }
        [DataMember]
        public string GpsX { get; set; }
        [DataMember]
        public string GpsY { get; set; }
        [DataMember]
        public bool IsDeleted { get; set; }
    }

    // The Country object as WS's client view it.
    [DataContract]
    [Serializable]
    public class Country
    {
        [DataMember]
        public int Id { get; set; }
        [DataMember]
        public string Label { get; set; }
        [DataMember]
        public int IDArea { get; set; }
        [DataMember]
        public Area Area { get; set; }
        [DataMember]
        public bool IsDeleted { get; set; }
    }

    // The Area object as WS's client view it.
    [DataContract]
    [Serializable]
    public class Area
    {
        [DataMember]
        public int Id { get; set; }
        [DataMember]
        public string Label { get; set; }
        [DataMember]
        public bool IsDeleted { get; set; }
    }

    // The Area object as WS's client view it.
    [DataContract]
    [Serializable]
    public class Message
    {
        [DataMember]
        public int Id { get; set; }
        [DataMember]
        public bool IsPrivate { get; set; }
        [DataMember]
        public string Subject { get; set; }
        [DataMember]
        public string Content { get; set; }
        [DataMember]
        public int IDSender { get; set; }
        [DataMember]
        public User Sender { get; set; }
        [DataMember]
        public int IDReceiver { get; set; }
        [DataMember]
        public User Receiver { get; set; }
        [DataMember]
        public bool SenderDel { get; set; }
        [DataMember]
        public bool ReceiverDel { get; set; }
        [DataMember]
        public bool ReceiverRead { get; set; }
        [DataMember]
        public DateTime Date { get; set; }
        [DataMember]
        public bool IsDeleted { get; set; }
    }

    [DataContract]
    [Serializable]
    public class RelationType
    {
        [DataMember]
        public int Id { get; set; }
        [DataMember]
        public String Value { get; set; }
        [DataMember]
        public bool IsDeleted { get; set; }
    }

}
